<template>
  <div class="banner">
    <div class="wrap">
        <swiper :options="swiperOption" v-if="showBanner">
            <!-- slides -->
            <swiper-slide v-for="item of list" :key="item.id">
              <img class="banner-img" :src="item.imgUrl" alt="">
            </swiper-slide>
            <!-- Optional controls -->
            <div class="swiper-pagination"  slot="pagination"></div>
        </swiper>
    </div>
  </div>
</template>

<script>
export default {
  name: 'HomeBanner',
  props: {
    list: Array
  },
  data () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination',
        loop: true
      }
    }
  },
  computed: {
    showBanner () {
      return this.list.length
    }
  }
}
</script>

<style lang="stylus" scoped>
    .wrap >>> .swiper-pagination-bullet-active
        background #fff
    .wrap
        overflow hidden
        width 100%
        height 0
        margin-top .86rem
        padding-bottom 31.25%
        backgroud #ccc
        .banner-img
            width 100%
</style>
